Searching for the optimal distance