Added smooth factor in gradients computation