cleaning up pagination of photos to keep things dry