refactor event handling