htmlizer: refactored to separate htmlcontent creation and writing to file