refactor paginator