Added checking for file duplicates