rewrite build script
compile with pthreads