Comparator: refactoring