Added autosave support

Fixes #21