some more cleanup and reorg