Began rewriting using the WeightedQuickUnionUF class