Moved jinja specific code to template mode. This allows for future potential template engine replacements