MOved all plugin handling to the plugins module. Fixed bug where operations didn't always execute due to wrong timing.