copy previous work of sorting