Adjusted G to gmax and d to u.