modified events.js