Rewrite block edging algorithm (without error correction).
Code refacted and adjusted.