Added test cases; fixed API definition.