Some tests, documentation and bug fixes.