Some loop variables are used outside the loop.

So we cannot make them locally scoped.