working version of NN