More restructuring, mostly for tests