Unless I'm missing something, there is no need for the `check` variable. You could just have
```Fortran
if (.not. statepoint_batch % contains(...)) then
```