Added back queue sort functionality