Fifth commit. Still not completed, but the multithreading has been fixed. Now just need to add the final touches.