Improve template Name class, and update Engine and Template classes accordingly.
Add tests for template Name class.