added last_response_code variable and updated and added some tests