Updating script for use with latest version of API