Cleaning up the viewer codebase