added parallelization using TBB