cleaned up the saveAndRun function a bit.