organize lib functions