Add regularization and more extensive logging