[#respect-network-flag-#75464982]: tidy up

Improve loop in next() to make it cover the whole range.

Improve comments and document an invariant.

Use more idiomatic Go.