Implemented figure 1 and figure 2