added event handlers to buttons.