main library functions