changed parameter order in dwald_r function to match others