Code for 2nd plot with comments.
Final version.