Added tests and doc