Add some of chapter 8 codes