Refactor of neuralnetwork.js complete.