Port Viterbi code to Forward