Prior to this commit there was a lot of duplicated code around the generation of HTML for templates. Clean up and simplify code by adding an HTMLHelper class with helper functions which can be used in place of repeated logic.