cleaned it up a touch, showed how to handle http errors