Added documentation and fixed a test.