Rewrite of Union Find Homework