Fixed default for argument d
Got sim_SEG() working satisfactorily