Finished off the ghost new line issue

Also added a debug helper