event sample refactor