Modifications from the chapter 5 exercises