MAINT: Refactored process_event to avoid duplication.