moved functions of plugin to local scope