Refactor: Use dispatcher and handler to separate events.