Significantly improve the trimming of the HTML