Viewer refactoring