Exercise 2 fixes

Some fixes for exercise 2.

There is still much more to do in this chapter, e.g. add line numbers to the code blocks as they are referenced in the text (but I don't know how to do that).