updated adjacency checking