adding event handling