Compiler refactoring to using map of emitting functions rather than a long list of if statements