refactored events to separate method