Defined an OutputLayer class for layer 2.
Factored key functions into OutputLayer.