add table sort functionality