refactor, adding events