Add common_ancestor function