Refactors out redundant eventsDict and pendingEvents array