Added multithreading functionality
Made too many changes, cant recall