break out prefs handling into reusable class