Added comments.

Also did other bits of minor cleanup.