replaced custom events with node's EventEmitter