added some preliminary stuff to save files before running.