documentation and a bit of cleanup in the plugin layer