added http response code handling