Modified to work with the REST client