Changed isSorted declaration