refactoring comparer