Big commit. Mostly implemented a plugin system using an event observer scheme.