Changed delete to check if the file exists first.