refactor plugins
#679