Add multithreading. Not working correctly