got connected components mostly working, some minor bugs left to resolve