new version with improved handling of html comments