Add pagination support.

Fixes #2.
Code style fix.