some code reorg