working neural network code