Further optimization for multiple threads