Improved handling for excluding files. Now uses file path rather than filename