updated multithreading part