Implementation : Added robustness in the line search.