HtmlElementsController refactoring