added some parallelization