Fixing up errs in code. The while loop was fubared. Blame James ;-)