Adding multithreading