add test case and refactor