Added multithreading option.