sorting done in separate thread