clean up viterbi algorithm