simplified loop processing
changes to EOF processing