remove line breaks and excess spaces