Add expansion of k if all the distances in the first k neighbours are =
Merge branch 'refinement'