Smoother PageViewer without lagging. Also some cleanup and refactoring.