made the cumulative density plot function a bit better