refactor to make emitter instance-based