1st version for multithread process