Closes #32 (closed). Similar to !83 (merged): instead of trying to fix it, I ported Haskell's new version.
I suspect intersection as well, because it also uses a hedge algorithm. But I haven't checked it yet (#33 (closed)).
This will create a new commit in order to revert the existing changes.