Refactored to add support for other template engines in a data driven fashion.