Added header response code handling