new implementation of neural network