refactoring code emitter