Move non-model federation stuff into lib/

Addresses Issue #4239