More cleanup of changes in viewer.js