Refactor the html renderer