Another round of efficiency improvements for the filename matching.