Finished first version of the code generator