Added code and plot 3