Changed a way of training NN