Changes to NCM in matrix consistency
Fixed optimizer
added steps to M step