added handling status codes