Plugin and Core refactoring