Better unit test coverage.
Minor bug fixes.