refactored the HtmlElements object to be a bit more functional