Added event type checking