Improved multithreading support