Miguel/plugin refactor