added switch statement to calcAdjacencies