modif to limit number of neirghbour to compare