Changed to use Pthreads, currently not working