Added support for saving to file.
Merge branch 'savefile'