event refactor