adding hmm code