Edited codegen for java