More tests and improved documentation.