Patched in plugin system.

Added the plugin system to allow use of plugins.