Updated the selection logic to apply on a per-page basis.