Added code for pager

Full code with documentation