events management refactoring