Updated to work with the latest version of API