Added function to set all the button states from an array