cleanup in the function
restructuring the plugin