Added sort functionality.