events manager refactoring