Update the pages() function to the new approach.