added templates and generating code