Added sort functionality