Closures for recursive functions

Instead of passing in the slice to put the results in, I am now declaring it outside of the function and using closures to share it between recursive steps.