add the code in Chapter 1