refact the plugin mechanisum and dialog