Added support for trailing newline.