rewrite the training program, make it loopbetter