events refactoring