adding multithreading to copy function