Documentation (and minor code cleanup).