DOCUMENT-50

Thanks to Josh Cooper, who pointed out a number of errors here that this
commit fixes.