Added save functionality to preferences.html