Figure 5 Algorithm 1.