added regularization to modesolver. -jm