More progress on viterbi algorithm