add memoization
add a good one
add infinite recursion check