Refactor initTableSorter and use it only when needed