completed backpropagation with regularization