Refactor plugin re