Proper parsing of newlines

Adds code to handle newline characters properly, and a test for the /actual/ requirement - rookie mistake #1