Added multithreading