faster unification algorithm