Sort pairs in groups for better perf
Remove a debug printf