implemented deep equality check