initial code event refactoring