added multithreading in Beagle