Refactoring of Event Listener