Rework SharedPreferences usage. Small fixes.