Notice that this method does not guarantee the optimum alignment; just a good one.