Added multithreading.