removing extra newlines etc.