corrections to 1.7 and 9.8, plus other minor tweaks
Correction to sample code