Updated for newer library versions