main sort complete