Insert necessary newlines