recur instead of using fake mutable locals