Move non-model federation stuff into lib/