changed signature - pass in a predicate to stop searching
looks a bit better
tail call recursion works, but still too slow
Merge branch 'improving-recursion'