Base code for plugin