Made filetype check a little DRYer.