added NNAgent code, which does not work yet.