Handle newlines correctly