Add multithreading support.