refactored _add_paging_headers a bit