added the multithreading