Added event handlers to the buttons