added error handling, async call, returns a json object