library functions