Add support for html tags
Minor refactoring