made changes to hmm code