First crack at code template generator, also mucked with projections some more