Improve Node.getAncestor