Small optimizations and added GUI control for regularization.