clean up of the NN training code