Equality operator code refactored