Code reorg for better re-use.