Added check for output file already existing.