Move most of the Stylesheet rendering helpers and logic into the Template class.

This class will act as the Public API for the custom templates to use.