DisjointSet structure refactored