chapter 10 Advanced Models source code