Docs2

Fix up unit tests and some other small bugs.