refactor moment calculation into its own function
add some basic tests for regularization algorithms