automate creation of buttons on index