refactored. Added emitter