init code for plugin version 2