removing extra space and newlines