Added ThreadData class to improve multithread efficiency.