recursive tree generation works