Adding pagination for viewer