Improved the string and comment matching rules