while -> if, since we will hit it again in the outer loop.