Newlines v2

A fresh attempt to support newlines. This pull request will hopefully fix #3 without the issues that the previous pull request had.