Consider moving the `if` into the for loop