Implemented backpropagation.