add event handling pattern