Modified for at end consistency

Modified to ensure that the at end condition is not reported prematurely (before the last line is processed).

Signed-off-by: Herb Bowie <hbowie@mac.com>