added a conditon to make _paginator function