Added Pagination helper. Fixed small bugs.

Added Pagination helper. Fixed small bugs.