Improved pagination (issue #7)