modified the pagination controller