Tracking references to subtrees