finished adding multithreading