start refactoring code into the plugin module