Fixed issue in sorting algorithm (comparator -> comparable)