Using correct API endpoint. Better error handling