Improvements to multithread