Refactored functions and constants. Implemented for loop for copying button array