Lots of bug fixes. Added ability to create plugins.