has better recursion