Added Pthreads implementation