moved minimumPointsDistance functionality to separate script