Finished initial coding of plugin system

Need to set up something for testing and clean out the bugs. But it's
basically done.