Sort with threads