slightly more functional pagination