refactored to work with updated library