better handling of responses, status codes, and headers