Tweaked EM initialization.
interim simplification of code.
Substantially simplified code.
Finished refactoring for now.