added isSorted
return values incorrect
TODO