Added API key and minor change to retry logic