refactor, add more test