First draft of reworked plugin system. Compiles. Untested.