Improved constructor of NeuralNet