Implemented figure 4