Reworked the DistnPlot function