Plugin refactor