Doing Chapter 2 exercises