Refactor and fix typed PagedViewer