Updated the delegation helper to recursively attempt to match parent nodes.