Made a multithreaded version of the main program to test