plugin refactoring and documentation