Added example code for examples 6 and 7 in chapter 12.