Improve autosave functionality

Now asks the user before applying autosaved changes, and saves changes more
intelligently.