added up and down functionalities for the buttons