move functions into pluginAPI module