Changed the neighbour counting to be a bit more efficient