code generation almost finished (intermediate)