Minor reorg of functions