Refactor the html helper and add exception classes