Updated to handle windows newlines