added parallelization in C++