removed trailing whitespace and added some DEBUG lines in linesearch