merge lines 62 through 65 into a single `if`