template generation

old code attempt to get the template generator to work