Refactoring page iterator class

- Removing duplicated code
Merge pull request #185 from jcabas/page_iterator_refactor

Refactoring page iterator class