Added tests and doc.