Neighbour logic refactored