Created a multithreaded implementation