[Work in progress] Rewrite union-find.