Setting up pagination stuff

Hoping this doesn't break anything yet.