Plugins refactored to pass instance and writing as arguments (instance has no public API though).