improved how min cat attributes is used

This comparator is defined twice, make it a class so the code isn't duplicated