added hmm code