refactor events_controller