New attempt at implementing BuildConnectivity and general formatting.