Cleaning up EventEmitter handling and some JS changes to fix grunt validation