Use splitlines() to better handle line endings