Improved the printing to support newlines