Refactor file match to reuse existing method