Implemented Viterbi algorithm!