Adding event listener to buttons