A complete redesign of the neural network

I refactored the neural network multiple times until I came up with
this. I think it is about as minimal as possible while still being
readable and flexible.