change api, add test cases