Some refactoring.
Bugfix: Fix named template output path

We must include the length of the brackets as well as the name... [name]
Added coverage for template_path output