made isAdjacent work better