Clean-up and refactor the plugin using classes.