done with contiguity calculation