added test function and documentation