Comparator class extracted, plus some simple refactoring
Comment updated