Adding check for duplicate files