restructuring to better keep scripts inside the plugin