refactoring about if