Fixes, improvements to code generation, start of prototypical model