updated distance max/min