upgraded training script