added chapter 06 code from mwd book