toHTML interface refactored