MAINT: Refactoring of unit equality

Relates to #651