refactor

Not to be merged yet. See notes on the refactor over in Smallest-Federated-Wiki