Seebs/pexpluginfixes

This is a handful of fixes for issues that caused the plugin sample to not be as modifiable as it should be, also cleaning up some dead code and unfinished things, and combining two very similar pieces of code, because the original bug was that a crucial line of code was in one but not the other.