implemented some lib functions