added a first version of parallelization