plugins_support

Cleaned up some code, am working on plugin support now.