major plugin refactor