Changed the code to fit the current Cloudty API.