wrote more debug code for connected component problem