Added the method for checking equivalence