corrected parallel version