refactoring events system