Added connected component code