add new test cases and code clean