General fixes, improvements and refactoring.

Added support for plugins and the default plugins for core services.