refactoring union_find