more test and refactoring