added tests and doc