Regularization of cost function implemented