Added check for already existing files.