Improved HTML processing