I think this logic is the only thing I don't love about this implementation. This logic could be pushed into the instance methods of the class. Perhaps only in the equality check.