I agree that this loop is unnecessary and at least should be replaced with `countUntil`.