Modifed the code for plot 1 and 2