add some test cases
refactoring