Added code and plot for task 4, minor amendments to plot2 code