cleanup sampleviewer code