code for Sort List