almost ready- added multithreaded