remove newlines and extra spaces when adding paragraphs