update code in ch07