Code generation mostly done