Added the multithreading feature