extract method for getViewer