An event emitter implementation