finished core of the plugin; cleaning and fixing stage