generalized feedforward to return A and Z
cleaned up code and finished generalized NN