extract out connected component methods