added file overwrite protection to the script