refactoring sortBlock to be NSComparator.