minor changes, starting adding control for the sorting thread.