improve training script