added new dwald c function