Fixed problems caused by the API returning errors, refactored API endpoint url.