Factor out the SPViewer class