Chapter 5. The chain function