Extended the timeout for API calls and added encoding