Flatten list before stripping newlines