working on the button logic