refactoring event processing service