Adds get_internal_nodes and get_leaf_nodes.