Reorg of code and tests.