added event handler for buttons