organized lib functions