Changed num_pages to total_pages