refactor parallel processing