Added tests and updated documentation.