Implemented pagination.

closes #1