incorporated Mr James Ferguson tree function

https://groups.google.com/d/msg/shiny-discuss/gANiMcFa_tA/tJbK1OctpZEJ