Added test program for the template-generator.
Extensive rewrite of template-generator.