added input variable for D