Adding some error checking/handling to the api calls, still need to make them better