Consolidated looping conditions inside reading functions into the initial while statements