Add checking for duplicate filenames