Switching to open-isns

Quite a big change, but that's what fate#316901 wanted.
Again, use `each_with_index` instead of `count` and `foreach`.