Add more features to code generator

Make the output more C-like
Finish generator and add a few more tests