Refactor event handlers

Change: remove unnecessary code and rename event handlers.