function now part of plugin class