Ripped out the ad-hoc event system and replaced it with a more robust one that combines elements of Node's EventEmitter with the previous event system, allowing events to be canceled and event listeners to be asynchronous.