optimize: using TrainerHelpers.parForeach instead of .par.foreach