Iterate in constant time

(The rest is still spaghetti, but now block mode is usable)