Reorg lib functions. (KK)