viterbi output cleanup