parallelization and bug fixes
deleted redundunt code