Added feature to collect the inner nodes of the tree