minor code reorg