added linesearch method