Removing the last newline is more complex than I thought :-)