Replacing string manipulation of status line with getting status code