refactor code that extracts the first line

Previously, if there were spaces in the first line, it would be
removed. The `.split` now looks for the `\n` line break.