finished code generator