Added prefs saving