nicer, more complex, easier and more robust pagination