changed title to fit script name change, added a few newlines, corrected die on failure to write files