code functionality of buttons