Implemented regularization for CoFi gradients