fixed bit of code to allow for text with newlines as there was a bug