Give variables more logical names.  Correct bug in calculating end-of-line flag.