simpler implementation of neural network