Merge in Karen's changes to the restart writing function. I may change this to have some optional arguments...