threading parallelization implementation