refactored code to move html dom processing into singleton class HtmlDomProcessor for reuse