Method 'replaceHtml' modified to do a better replacement