modified events.js controller