general cleanup and reorg