adding a max_depth to the tree printing

To help debug rather large trees. I ran into a need for this with a depth of 25. 

I also saved that tree as json, I had to add a :max_nesting option to the "as_json" call. Not sure if that's something you want so I'm not including it in the pull request, but figured it was worth mentioning.