Added tests and update doc.