added test cases and documentation