re-organize cal_dn_ds method