IMP improve error messages.
CHG refactor to extract a line function that get the
    nth line from stdin