double max value set to initial minimal distance