Multithreading version