Refactor iteration and test using \r\n linebreaks