viterbi alg implemented (maybe)