refactored to prevent double loop through event maps