Improved tests.
Added documentation.