Refactored code to use a proxy emitter.