Changed fork to pthreads