Add some documentation.
Work around a couple of minor bugs.