Modified for new library functions