added the funtionality to the buttons