Viewer code cleanup.