Chaned multithread version.