added SAM sorting back.