Changed tree_id to use same value as the root's node_id
Improved ancestor check
Removed unused tree_data for now