simplifying events.js