Started rewriting event processing (currently broken)