added tests and updated documentation