Cleaning up and refactoring the emitter module.