restructuring code-base to add generalized regularization