Code for Section 3.

Code discussed in Section 3 of the tutorial.