Normalize line endings (CR > CRLF)
Corrected issue: Last item disappears after list reaches the end.
Some code improvements