Complete refactoring of events and units