modified StartCodeGeneration