Add a loop to fetch pages