Move prefs setup to context initialized handler