Refactored html escaping.