implemented isEqual method