refactored to event publishing