sorted previous and almost sorted next
sorting out next and previous