much better subtree marking, based on the largest-common-subtree algorithm