new code for Viewer
other changes