Viewer plugin API refactoring