Changed the ChooseThreeNeighbors function.