refactoring html renderer