MAINT: Refactoring of unit equality

Relates to #561