Sorted the multithreading properly!