Additional cleanup and refactoring of the Freemarker templates.

Semantic variables introduced into the freemarker templates to improve understandibility.