Use loop/recur to avoid stack problems.