added http status check to code