Added recursive function for leaf collection, removed recursive partials
Fixed leafs array construction