Rename d1 function to d_1 to prevent overlap. Fix and finish problem 4