modified data fetching loop