implemented EM algorithm. Still have to do same finishing.