Refactor `if` condition