refactor event.rb