This is simpler than the the other case, so I thought a while loop would be clearer than recursion.