Added tests and documentation.