Added regularization

Regularization part of the exercise.