Refactor pager scripts  into class