modify checkNeighbour function

-> add index argument