Tested and debugged Viterbi2.