-Refactored code to conform to new library API.