Enhancements for sub-assemblies, separate templates and updated tests

If you put whitespace inside the curly braces, it also fixes the problem, but I wonder if we should suggest that as an option `{{ CLOSE }}` will not get replaced.