Refactored UnionFind with hlint