Changed the button layout so that it repeats the buttons depending on how many classes are in the javascript.