Programming style.
Correct template name validation, add comments.