Improve documentation and tests.