refactoring and making the events.js code more readable

Getting read of some unused variables, making variable names more readable.