Updated to the new api so that we can run the script again, however, there still seems to be problems.