Abstract out preferences handling.