added method isSorted()