remove newlines from function line results, simplify joining them