Plugin framework improvments

Entirely untested, sorry