Error in arrayToSortedList() corrected.