Modifying code for Figure 2A and B