Refactor complete.

Finished refactoring of core, and plugins.