Refactoring getCellSort.