Rework match_by_filename
Rework test to make use of match_by_filename