Simplify the filename check.

Make it cleaner.