The probability (1) or the score (3) can (in principle) be calculated for all possible alignments to a model, and thus the most probable (i.e., the best) can be found. There exists a dynamic programming technique, called the Viterbi algorithm [Rabiner, 1989], that can find the best alignment and its probability without going through all the possible alignments. It is this best alignment to the model that is used to produce multiple alignments of a set of sequences. For each of the sequences the alignment to the model is found. The columns of the multiple alignment are then determined by the match states. All the amino acids matched to a particular match state are placed under each other to form the columns of the alignments. For sequences that do not have a match to a certain match state, a gap character is added (Figure 2).