added ApplyGradient