Modified linesearch to make error generation the methods job