Minor cleanup and a lot of commenting.