Fixed event type/namespace ordering and condensed event handling and used switch/case where possible to boost performance.