Modified Pager

Modified the function according to the review comments.