Added basic multithreading support