Migrated library to use deferred objects and promises.