Refactoring save functionality since the autosave really blew.