Refactored neural network