use event emitter instead