Added missing 1/2's from dcost equations.