Refactoring: Extract event handler as a new method.