still a work in progress. there's an off by one error floating around in here somewhere. todo: preallocate only the number of buttons we will need to show at once, not 1..n buttons.