more reorg + unit tests for accounts api