worked on button logic