draft to refactor the plugin from scratch