cleaned up code gen a little