Pretty sure there is a (not-so-pretty) way to write it as a tail-recursive call.