wrote events.js