more code reorg