Simplified find_and_replace_subtree