added logic to account for windows using different newline character