added sim_d.R