added authentication and a few checks about the response status code