changed logics to include prefs