Updated parser to take newlines into consideration