Initialize buttons and listeners using a for loop