Added functions to generate and parse templates.