fixed the way that restorePrefs works. Also created saving and restoring file methods for Json strings.