renamed g ==> d for some arguments