viterbi code refactor and restructure files.