Modified implementation, refactored code for DisjointSet, added a bit of documentation