Refactor pageing hepler