I think we can move this read inside the if statement, that way we don't have to read the file if we don't have a line. Also, what about windows newlines?