Added basic multithreading.