added regularized gradient