Converted this to use the REST API