cleaned up code generator slightly