added minDistance value