Removed External sorting. Used Arrays.sort with own Comparator instead.