changed formatting slightly
union find added