Only use outermost nodes to find common ancestors

Can greatly reduce the number of function calls made